/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="red")
public class Red implements Serializable {
	public Red() {
	}
	
	private int id;
	
	private Integer amount;
	
	private Integer num;
	
	private Integer perNum;
	
	private String wishing;
	
	private String title;
	
	private String remark;
	
	private java.util.Date startTime;
	
	private java.util.Date endTime;
	
	private java.util.Set memberRed = new java.util.HashSet();
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_RED_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_RED_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 总金额
	 */
	public void setAmount(int value) {
		setAmount(new Integer(value));
	}
	
	/**
	 * 总金额
	 */
	public void setAmount(Integer value) {
		this.amount = value;
	}
	
	/**
	 * 总金额
	 */
	@Column(name="amount", nullable=true, length=10)	
	public Integer getAmount() {
		return amount;
	}
	
	/**
	 * 种子红包数量
	 */
	public void setNum(int value) {
		setNum(new Integer(value));
	}
	
	/**
	 * 种子红包数量
	 */
	public void setNum(Integer value) {
		this.num = value;
	}
	
	/**
	 * 种子红包数量
	 */
	@Column(name="num", nullable=true, length=10)	
	public Integer getNum() {
		return num;
	}
	
	/**
	 * 每个种子红包多少人领取
	 */
	public void setPerNum(int value) {
		setPerNum(new Integer(value));
	}
	
	/**
	 * 每个种子红包多少人领取
	 */
	public void setPerNum(Integer value) {
		this.perNum = value;
	}
	
	/**
	 * 每个种子红包多少人领取
	 */
	@Column(name="perNum", nullable=true, length=10)	
	public Integer getPerNum() {
		return perNum;
	}
	
	/**
	 * 祝福语
	 */
	public void setWishing(String value) {
		this.wishing = value;
	}
	
	/**
	 * 祝福语
	 */
	@Column(name="wishing", nullable=true, length=255)	
	public String getWishing() {
		return wishing;
	}
	
	/**
	 * 活动名称
	 */
	public void setTitle(String value) {
		this.title = value;
	}
	
	/**
	 * 活动名称
	 */
	@Column(name="title", nullable=true, length=255)	
	public String getTitle() {
		return title;
	}
	
	/**
	 * 备注
	 */
	public void setRemark(String value) {
		this.remark = value;
	}
	
	/**
	 * 备注
	 */
	@Column(name="remark", nullable=true, length=255)	
	public String getRemark() {
		return remark;
	}
	
	/**
	 * 开始时间
	 */
	public void setStartTime(java.util.Date value) {
		this.startTime = value;
	}
	
	/**
	 * 开始时间
	 */
	@Column(name="startTime", nullable=true)	
	@Temporal(TemporalType.TIMESTAMP)	
	public java.util.Date getStartTime() {
		return startTime;
	}
	
	/**
	 * 结束时间
	 */
	public void setEndTime(java.util.Date value) {
		this.endTime = value;
	}
	
	/**
	 * 结束时间
	 */
	@Column(name="endTime", nullable=true)	
	@Temporal(TemporalType.TIMESTAMP)	
	public java.util.Date getEndTime() {
		return endTime;
	}
	
	public void setMemberRed(java.util.Set value) {
		this.memberRed = value;
	}
	
	@OneToMany(mappedBy="red", targetEntity=cn.imvc.app.entities.MemberRed.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getMemberRed() {
		return memberRed;
	}
	
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("Red[ ");
			sb.append("Id=").append(getId()).append(" ");
			sb.append("Amount=").append(getAmount()).append(" ");
			sb.append("Num=").append(getNum()).append(" ");
			sb.append("PerNum=").append(getPerNum()).append(" ");
			sb.append("Wishing=").append(getWishing()).append(" ");
			sb.append("Title=").append(getTitle()).append(" ");
			sb.append("Remark=").append(getRemark()).append(" ");
			sb.append("StartTime=").append(getStartTime()).append(" ");
			sb.append("EndTime=").append(getEndTime()).append(" ");
			sb.append("MemberRed.size=").append(getMemberRed().size()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
